cmake_minimum_required(VERSION 3.10)

add_subdirectory(common)
add_subdirectory(log)
add_subdirectory(sys)
add_subdirectory(msg)
add_subdirectory(db)
add_subdirectory(options)
add_subdirectory(com)
add_subdirectory(ascom)

if(NOT WIN32)
	add_subdirectory(io)
endif()

add_subdirectory(protocol)

find_package(CxxTest)
if(CXXTEST_FOUND)
    include_directories(${CXXTEST_INCLUDE_DIR})
    enable_testing()
    CXXTEST_ADD_TEST(test_os test_os.cpp 
    	${CMAKE_CURRENT_SOURCE_DIR}/test/shared_buf.hxx
    	${CMAKE_CURRENT_SOURCE_DIR}/test/shared_buffer_mgr.hxx
    	${CMAKE_CURRENT_SOURCE_DIR}/test/shared_rt_record.hxx
    	${CMAKE_CURRENT_SOURCE_DIR}/test/shared_rt_mgr.hxx
    	)
	if(WIN32)
		target_link_libraries(test_os oslog dmos)
	else()
		target_link_libraries(test_os oslog dmos pthread)
	endif()
	set_target_properties(test_os PROPERTIES WIN32_MANIFEST "NO")
endif()